package com.nbjtjc.safe.job.mapper;

import com.nbjtjc.safe.job.model.ScheduleJobEntity;
import com.nbjtjc.util.MyMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ScheduleJobMapper extends MyMapper<ScheduleJobEntity> {

    @Select("select * from schedule_job where bean_name =#{beanName} and params like #{params}")
    List<ScheduleJobEntity> selectJob(@Param("beanName") String beanName, @Param("params") String paramsLike);

    List<ScheduleJobEntity> search(@Param("scheduleJob") ScheduleJobEntity scheduleJobEntity);
    @Select("<script>"+
            "update schedule_job set status=#{status}" +
            "  where job_id in " +
            " <foreach item='jobId' index='index' collection='jobIds'      open='(' separator=',' close=')'> " +
            "#{jobId}" +
            " </foreach> " +
            "</script>")
    int updateStatusBatch(@Param("jobIds") List<Long> jobIds,@Param("status") int status);
}